package com.yxw.springmvc.userBehavior.security;

/**
 * Base64工具类
 * Author: Terence
 * Date:   2014/8/15
 * Time:   10:03
 */
public class Base64Utils {
    private Base64Utils() {
    }

    /**
     * <p>
     * BASE64字符串解码为二进制数据
     * </p>
     *
     * @param base64
     * @return
     */
    public static byte[] decode(String base64) {
        return Base64.decode(base64.getBytes());
    }

    /**
     * <p>
     * 二进制数据编码为BASE64字符串
     * </p>
     *
     * @param bytes
     * @return
     */
    public static String encode(byte[] bytes) {
        return new String(Base64.encode(bytes));
    }
}
